****************************************
* Title: The Urban-Rural Divide in Policy Priorities across Time and Space
****************************************
* Journal: Political Science Reseach and Methods (2025)
****************************************
* Author 1: Tevfik Murat Yildirim, 
* Associate Professor of  Political Science, University of Stavanger, Norway
* Author 2: Knut Martin Solvig, 
* Undergraduate Student, University of Stavanger, Norway
****************************************


log using "psrm.smcl", replace


cd "/Users/tevfikmuratyildirim/Desktop/Replication PSRM"

* use PSRM.dta
use "/Users/tevfikmuratyildirim/Desktop/Replication PSRM/PSRM.dta" 

* Notes about the dataset: We are unable to share the full dataset due to copyright issues. Access to the dataset can be
* obtained through Cornell's Roper Center for Public Opinion Research  
 
****************************************
* First step: Merge the Correlates of State Policy data
****************************************
 
merge m:m states year using correlates_state.dta

numlabel, add



gen democrat = cond(party_id == ., ., cond(party_id < -1, 1, 0))
gen repub = cond(party_id == ., ., cond(party_id > 1, 1, 0))
gen indep = 0
replace indep = 1 if party_id == -1 | party_id==0 | party_id ==1
replace indep = . if party_id ==.

* three-category partisanship
gen party = .
replace party = 1 if democrat ==1
replace party = 2 if indep ==1
replace party = 3 if repub ==1 

recode state(999=.)



****************************************
* Create Individual categories (Dependent Variables)
 ****************************************
 
* economy (excluding taxes)
gen economy = (mipcode1_r1 >= 100 & mipcode1_r1 <= 108) | (mipcode1_r1 == 110) | ///
              (mipcode2_r1 >= 100 & mipcode2_r1 <= 108) | (mipcode2_r1 == 110) | ///
              (mipcode3_r1 >= 100 & mipcode3_r1 <= 108) | (mipcode3_r1 == 110) | ///
              (mipcode4_r1 >= 100 & mipcode4_r1 <= 108) | (mipcode4_r1 == 110) | ///
              (mipcode5_r1 >= 100 & mipcode5_r1 <= 108) | (mipcode5_r1 == 110)


gen tax = (mipcode1_r1 == 109 | mipcode2_r1 == 109 | mipcode3_r1 == 109 | mipcode4_r1 == 109 | mipcode5_r1 == 109)


* rights/freedom 
gen rights = (mipcode1_r1 >= 300 & mipcode1_r1 <= 310) | ///
             (mipcode2_r1 >= 300 & mipcode2_r1 <= 310) | ///
             (mipcode3_r1 >= 300 & mipcode3_r1 <= 310) | ///
             (mipcode4_r1 >= 300 & mipcode4_r1 <= 310) | ///
             (mipcode5_r1 >= 300 & mipcode5_r1 <= 310)


* crime + political violence
gen crime = (mipcode1_r1 == 401 | mipcode1_r1 == 407) | ///
            (mipcode2_r1 == 401 | mipcode2_r1 == 407) | ///
            (mipcode3_r1 == 401 | mipcode3_r1 == 407) | ///
            (mipcode4_r1 == 401 | mipcode4_r1 == 407) | ///
            (mipcode5_r1 == 401 | mipcode5_r1 == 407)


* gov't spending, budget
gen budget = (mipcode1_r1 >= 500 & mipcode1_r1 <= 507) | ///
             (mipcode2_r1 >= 500 & mipcode2_r1 <= 507) | ///
             (mipcode3_r1 >= 500 & mipcode3_r1 <= 507) | ///
             (mipcode4_r1 >= 500 & mipcode4_r1 <= 507) | ///
             (mipcode5_r1 >= 500 & mipcode5_r1 <= 507)


* agricultural policy
gen agric = (mipcode1_r1 == 508 | mipcode2_r1 == 508 | mipcode3_r1 == 508 | mipcode4_r1 == 508 | mipcode5_r1 == 508)


* immigration
gen immig = (mipcode1_r1 == 509 | mipcode2_r1 == 509 | mipcode3_r1 == 509 | mipcode4_r1 == 509 | mipcode5_r1 == 509)



* morals, values, culture
gen values = (mipcode1_r1 >= 900 & mipcode1_r1 <= 909) | ///
             (mipcode2_r1 >= 900 & mipcode2_r1 <= 909) | ///
             (mipcode3_r1 >= 900 & mipcode3_r1 <= 909) | ///
             (mipcode4_r1 >= 900 & mipcode4_r1 <= 909) | ///
             (mipcode5_r1 >= 900 & mipcode5_r1 <= 909)


* Education
gen edu = (mipcode1_r1 == 203 | mipcode2_r1 == 203 | mipcode3_r1 == 203 | mipcode4_r1 == 203 | mipcode5_r1 == 203)

* Health care
gen health = (mipcode1_r1 == 204 | mipcode2_r1 == 204 | mipcode3_r1 == 204 | mipcode4_r1 == 204 | mipcode5_r1 == 204)

* foreign policy + foreign aid + other countries + crises
gen fpolicy = 0
replace fpolicy = 1 if inlist(mipcode1_r1, 601, 608, 610, 611, 606) ///
                     | inlist(mipcode2_r1, 601, 608, 610, 611, 606) ///
                     | inlist(mipcode3_r1, 601, 608, 610, 611, 606) ///
                     | inlist(mipcode4_r1, 601, 608, 610, 611, 606) ///
                     | inlist(mipcode5_r1, 601, 608, 610, 611, 606) 
					  
* nat security, nuclear weapons, terrorism
gen natsec = 0
replace natsec = 1 if inlist(mipcode1_r1, 602, 603, 604) ///
                     | inlist(mipcode2_r1, 602, 603, 604) ///
                     | inlist(mipcode3_r1, 602, 603, 604) ///
                     | inlist(mipcode4_r1, 602, 603, 604) ///
                     | inlist(mipcode5_r1, 602, 603, 604)

* War
gen war = 0
replace war = 1 if inlist(mipcode1_r1, 605) ///
                 | inlist(mipcode2_r1, 605) ///
                 | inlist(mipcode3_r1, 605) ///
                 | inlist(mipcode4_r1, 605) ///
                 | inlist(mipcode5_r1, 605)

* Drugs
gen drugs = 0
replace drugs = 1 if inlist(mipcode1_r1, 404) ///
                 | inlist(mipcode2_r1, 404) ///
                 | inlist(mipcode3_r1, 404) ///
                 | inlist(mipcode4_r1, 404) ///
                 | inlist(mipcode5_r1, 404)

replace mood = "." if mood== "NA"
gen mood2 = real(mood)

replace pollib_median = "." if mood== "NA"
gen poliblib = real(pollib_median)



****************************************
* Set scheme options
****************************************
grstyle clear
set scheme s2color
grstyle init
grstyle set plain, box
grstyle color background white
grstyle set color Set1
grstyle yesno draw_major_hgrid yes
grstyle yesno draw_major_ygrid yes
grstyle color major_grid gs8
grstyle linepattern major_grid dot
grstyle set legend 4, box inside
grstyle color ci_area gs12%50





****************************************
* Create base weights using CENSUS data   
****************************************

*** Generate a "decade" and "year" variables.  
gen decade = year(fw_end)
recode decade (1940/1949=1940) (1950/1959=1950) (1960/1969=1960) (1970/1979=1970) (1980/1989=1980) (1990/1999=1990) (2000/2009=2000) (2010/2019=2010) (2020/2029=2020)

*** Generate the age bands variable
gen agebands = age
recode agebands (min/34=1) (35/54=2) (55/max=3)

*** Create survey weights 
		* Merge in the population proportions
sort decade agebands male white edulevel
rename _merge MERGEEE
merge m:1 decade agebands male white edulevel using weight_amwe2.dta 
tab _merge 
*drop if _merge == 2
*drop _merge
sort decade agebands male white
order _merge pop_amwe




****** Create new `Urban' variables to be used in Coefplots.
foreach var in econ tax rights crime budget agric immig values energy fpolicy natsec drugs edu health social {
    gen `var'urban = urban
}






****************************************
* Analysis: Tables and Figures in the main text
****************************************
	
	
****************************************
**** FIGURE 1: Urban-Rural Gaps in Twelve Issue Categories
****************************************

logit economy econurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store economy

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(econ, replace)

logit tax taxurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store tax

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(tax, replace)

logit rights rightsurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store rights

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(rights, replace)

logit crime crimeurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store crime

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(crime, replace)

logit budget budgeturban i.party male south white age edulevel income_quartile dem i.year, or
estimates store budget

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(budget, replace)

logit agric agricurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store agric

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(agric, replace)

logit immig immigurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store immig

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(immig, replace)

logit values valuesurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store values

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(values, replace)

logit fpolicy fpolicyurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store fpolicy

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(fpolicy, replace)

logit drugs drugsurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store drugs

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(drugs, replace)

logit edu eduurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store edu

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(edu, replace)

logit health healthurban i.party male south white age edulevel income_quartile dem i.year, or
estimates store health

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(health, replace)


*** COEFPLOT
#delim;
coefplot (economy)  (health) (edu) (drugs) (fpolicy) (values) (immig) (agric) (budget) (crime) (rights) (tax), keep(econurban taxurban ///
 rightsurban crimeurban budgeturban agricurban immigurban valuesurban energyurban fpolicyurban natsecurban drugsurban eduurban healthurban socialurban) coeflabels(econurban= "Economy" 
taxurban= "Tax" rightsurban= "Civil Rights" crimeurban= "Crime" budgeturban= "Budget" agricurban= "Agriculture" 
immigurban= "Immigration" valuesurban= "Values" fpolicyurban= "Foreign Policy"  
drugsurban= "Drugs" eduurban= "Education" healthurban= "Health",) xtitle(Odds Ratio) eform xlabel(1) mfcolor(black) msymbol(X) legend(off) 
 levels(95) yscale(alt) name(figurefem, replace);
#delimit cr





****************************************
**** FIGURE 2: Urban-Rural Gaps in the Prioritizatin of Budget Deficit, Agriculture, Moral Values, Immigration
			 * Economy, and Tax across Time, 1960-2020
****************************************

logit budget i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(budget, replace)

logit agric i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(agric, replace)

logit values i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(values, replace)

logit immig i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(immig, replace)

logit economy i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(econ, replace)

logit tax i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(tax, replace)

graph combine budget agric values immig econ tax


****************************************
**** FIGURE 3: Urban-Rural Gaps in the Prioritizatin of Civil Rights, Crime, Education, Foreign Policy Health, Drugs
			 * across Time, 1960-2020
****************************************


logit rights i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(rights, replace)

logit crime i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(crime, replace)

logit edu i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(edu, replace)

logit fpolicy i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(fpolicy, replace)

logit health i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(health, replace)

logit drugs i.urban##c.year i.party male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(drugs, replace)


graph combine rights crime edu fpolicy health drugs



****************************************
**** FIGURE 4: The Interactive Effects of Partisan Affiliation and Urban-Rural Residence on the Prioritization of Budget 
			 * Deficit, Agriculture, Moral Values, Immigration, Economy, and Tax across Time, 1960-2020
****************************************

logit budget i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_budget, replace)

logit agric i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_agric, replace)

logit values i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_values, replace)

logit immig i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_immig, replace)

logit economy i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_economy, replace)

logit tax i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_tax, replace)


graph combine party_budget party_agric party_values party_immig party_economy party_tax




****************************************
**** FIGURE 5: The Interactive Effects of Partisan Affiliation and Urban-Rural Residence on the Prioritization of Civil 
			 * Rights, Crime, Education, Foreign Policy, Health and Drugs across Time, 1960-2020
****************************************

logit rights i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gray) lpattern("--")) name(party_rights, replace)

logit crime i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_crime, replace)

logit edu i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_edu, replace)

logit fpolicy i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_fpolicy, replace)

logit health i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_health, replace)

logit drugs i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_drugs, replace)


graph combine party_rights party_crime party_edu party_fpolicy party_health party_drugs





log close


********************************************************************************
********************************************************************************


****************************************
* Appendix Material: Additional Analysis, Tables and Figures
****************************************


********************************************************************************
********************************************************************************



****************************************
* Descriptive Figures in the Online Appendix
****************************************


* How many respondents from each source?: FIGURE C1
* Labels: 23 Gallup, 18 Princeton, 17 NYTIMES, 14 LA Times, 10 Harris, 8 Chilton, 6 * 5 CBS/NYTIMES, 3 ANES, 2 ABC, 0 Other
gen toptensurvey = 0
replace toptensurvey = 2 if survey== 2
replace toptensurvey = 3 if survey== 3
replace toptensurvey = 5 if survey== 5
replace toptensurvey = 6 if survey== 6
replace toptensurvey = 8 if survey== 8
replace toptensurvey = 10 if survey== 10
replace toptensurvey = 14 if survey== 14
replace toptensurvey = 18 if survey== 18
replace toptensurvey = 17 if survey== 17
replace toptensurvey = 23 if survey== 23


graph bar (count), over(toptensurvey) ///
    ytitle("Number of Respondents") ///
    title("Number of Respondents per Year")
	
* Number of respondents per year: FIGURE C4	
preserve
gen respondents=1	
collapse (count) respondents, by(year)
twoway (line respondents year), ///
    ytitle("Number of Respondents") ///
    xtitle("Year") ///
    title("Number of Respondents Over Time")
restore

* Number of respondents across urban rural areas: FIGURE C3
graph bar (count), over(urban) ///
    ytitle("Number of Respondents") ///
    title("Urban vs. Rural Respondents") ///
    subtitle("Across All Years") ///
    legend(label(1 "Rural") label(2 "Urban"))

* Number of respondents across partisan id: FIGURE C2
graph bar (count), over(party) ///
    ytitle("Number of Respondents") ///
    title("Respondents by Party Affiliation") ///
    subtitle("Across All Years") ///
    legend(label(1 "Democrat") label(2 "Independent") label(2 "Republican"))
	
	
* Intersection of Year, Urban/Rural, and Party Affiliation: FIGURE C5
preserve
gen urbanrep = 0
replace urbanrep = 1 if party==3 & urban==1
gen ruralrep = 0
replace ruralrep = 1 if party==3 & urban==0
gen urbandem = 0
replace urbandem=1 if party==1 & urban==1
gen ruraldem=0
replace ruraldem=1 if party==1 & urban==0

collapse (sum) urbanrep ruralrep urbandem ruraldem, by(year)
twoway (line urbanrep year), ///
|| line ruralrep year, lcolor(blue) lpattern(dash) ///
|| line urbandem year, lcolor(orange) lpattern(dash) ///
|| line ruraldem year, lcolor(grey) lpattern(dash) ///
    ytitle("Number of Respondents") ///
    xtitle("Year") ///
    title("Respondents by Party and Urban/Rural Group Over Time") 
restore




****************************************
**** FIGURE B1, FIGURE B2, and FIGURE B3 (Economic Inequality)
****************************************

melogit economy i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_econ, replace)

melogit tax i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_tax, replace)

melogit rights i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_rights, replace)

melogit crime i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_crime, replace)

melogit budget i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_budget, replace)

melogit agric i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_agric, replace)

melogit immig i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_immig, replace)

melogit values i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_values, replace)

melogit fpolicy i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_fpolicy, replace)

melogit natsec i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_natsec, replace)

melogit drugs i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_drugs, replace)

melogit edu i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_edu, replace)

melogit health i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_health, replace)

melogit social i.urban##c.gini i.party male south white age edulevel income_quartile dem year || state: 
margins, at(gini=(0.32(0.1)0.72) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(gini_social, replace)



****************************************
**** FIGURE B4, FIGURE B5, and FIGURE B6 (Policy Liberalism)
****************************************


replace pollib_median = "." if pollib_median== "NA"
gen pollib = real(pollib_median)

melogit economy i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_econ, replace)

melogit tax i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_tax, replace)

melogit rights i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_rights, replace)

melogit crime i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_crime, replace)

melogit budget i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_budget, replace)

melogit agric i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_agric, replace)

melogit immig i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_immig, replace)

melogit values i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_values, replace)

melogit anti i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_anti, replace)

melogit energy i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_energy, replace)

melogit fpolicy i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_fpolicy, replace)

melogit natsec i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_natsec, replace)

melogit drugs i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_drugs, replace)

melogit edu i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_edu, replace)

melogit health i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_health, replace)

melogit social i.urban##c.pollib i.party male south white age edulevel income_quartile dem year || state: 
margins, at(pollib=(-2.52(1)2.81) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(lib_social, replace)





****************************************
**** FIGURE C1: Coefplot without the income-level variable (1939-2020)
****************************************

drop _est_economy _est_health _est_edu _est_drugs _est_fpolicy _est_values _est_immig _est_agric _est_budget _est_crime _est_rights _est_tax


logit economy econurban i.party male south white age edulevel dem i.year, or
estimates store economy

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(econ, replace)

logit tax taxurban i.party male south white age edulevel dem i.year, or
estimates store tax

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(tax, replace)

logit rights rightsurban i.party male south white age edulevel dem i.year, or
estimates store rights

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(rights, replace)

logit crime crimeurban i.party male south white age edulevel dem i.year, or
estimates store crime

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(crime, replace)

logit budget budgeturban i.party male south white age edulevel dem i.year, or
estimates store budget

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(budget, replace)

logit agric agricurban i.party male south white age edulevel dem i.year, or
estimates store agric

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(agric, replace)

logit immig immigurban i.party male south white age edulevel dem i.year, or
estimates store immig

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(immig, replace)

logit values valuesurban i.party male south white age edulevel dem i.year, or
estimates store values

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(values, replace)

logit fpolicy fpolicyurban i.party male south white age edulevel dem i.year, or
estimates store fpolicy

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(fpolicy, replace)

logit drugs drugsurban i.party male south white age edulevel dem i.year, or
estimates store drugs

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(drugs, replace)

logit edu eduurban i.party male south white age edulevel dem i.year, or
estimates store edu

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(edu, replace)

logit health healthurban i.party male south white age edulevel dem i.year, or
estimates store health

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(health, replace)


#delim;
coefplot (economy)  (health) (edu) (drugs) (fpolicy) (values) (immig) (agric) (budget) (crime) (rights) (tax), keep(econurban taxurban ///
 rightsurban crimeurban budgeturban agricurban immigurban valuesurban energyurban fpolicyurban natsecurban drugsurban eduurban healthurban socialurban) coeflabels(econurban= "Economy" 
taxurban= "Tax" rightsurban= "Civil Rights" crimeurban= "Crime" budgeturban= "Budget" agricurban= "Agriculture" 
immigurban= "Immigration" valuesurban= "Values" fpolicyurban= "Foreign Policy"  
drugsurban= "Drugs" eduurban= "Education" healthurban= "Health",) xtitle(Odds Ratio) eform xlabel(1) mfcolor(black) msymbol(X) legend(off) 
 levels(95) yscale(alt) name(figurefem, replace);
#delimit cr

********************************************************************


****************************************
**** FIGURE C2: Coefplot with survey weights
****************************************
drop _est_economy _est_health _est_edu _est_drugs _est_fpolicy _est_values _est_immig _est_agric _est_budget _est_crime _est_rights _est_tax


logit economy econurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store economy

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(econ, replace)

logit tax taxurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store tax

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(tax, replace)

logit rights rightsurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store rights

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(rights, replace)

logit crime crimeurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store crime

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(crime, replace)

logit budget budgeturban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store budget

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(budget, replace)

logit agric agricurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store agric

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(agric, replace)

logit immig immigurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store immig

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(immig, replace)

logit values valuesurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store values

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(values, replace)

logit fpolicy fpolicyurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store fpolicy

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(fpolicy, replace)

logit drugs drugsurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store drugs

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(drugs, replace)

logit edu eduurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store edu

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(edu, replace)

logit health healthurban i.party male south white age edulevel income_quartile dem i.year [pw=pop_amwe], or
estimates store health

*margins, at(urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) name(health, replace)



#delim;
coefplot (economy)  (health) (edu) (drugs) (fpolicy) (values) (immig) (agric) (budget) (crime) (rights) (tax), keep(econurban taxurban ///
 rightsurban crimeurban budgeturban agricurban immigurban valuesurban energyurban fpolicyurban natsecurban drugsurban eduurban healthurban socialurban) coeflabels(econurban= "Economy" 
taxurban= "Tax" rightsurban= "Civil Rights" crimeurban= "Crime" budgeturban= "Budget" agricurban= "Agriculture" 
immigurban= "Immigration" valuesurban= "Values" fpolicyurban= "Foreign Policy"  
drugsurban= "Drugs" eduurban= "Education" healthurban= "Health",) xtitle(Odds Ratio) eform xlabel(1) mfcolor(black) msymbol(X) legend(off) 
 levels(95) yscale(alt) name(figurefem, replace);
#delimit cr






****************************************
**** FIGURE C3: The Urban-Rural Divide in 'Morals and Values', 'Family Values', 'Lack of Religion', and 'Abortion' as the MIP
****************************************

gen morals = (mipcode1_r1 == 901 | mipcode2_r1 == 901 | mipcode3_r1 == 901 | ///
              mipcode4_r1 == 901 | mipcode5_r1 == 901 | mipcode6_r1 == 901)

gen family = (mipcode1_r1 == 902 | mipcode2_r1 == 902 | mipcode3_r1 == 902 | ///
              mipcode4_r1 == 902 | mipcode5_r1 == 902 | mipcode6_r1 == 902)

gen religion = (mipcode1_r1 == 903 | mipcode2_r1 == 903 | mipcode3_r1 == 903 | ///
                mipcode4_r1 == 903 | mipcode5_r1 == 903 | mipcode6_r1 == 903)

gen abortion = (mipcode1_r1 == 905 | mipcode2_r1 == 905 | mipcode3_r1 == 905 | ///
                mipcode4_r1 == 905 | mipcode5_r1 == 905 | mipcode6_r1 == 905)



logit morals i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gray) lpattern("--")) name(morals, replace)

logit family i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gray) lpattern("--")) name(famil, replace)

logit religion i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gray) lpattern("--")) name(relig, replace)

logit abortion i.urban##i.party##c.year male south white age edulevel income_quartile dem 
margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gray) lpattern("--")) name(abortion, replace)


graph combine morals famil relig abortion







****************************************************************************************************
* TABLE C1 and TABLE C2 in the Appendix
****************************************************************************************************


* Urban-Rural Gaps across Time
logit economy i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo econ

margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(econ, replace)

logit tax i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo tax

margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(tax, replace)

logit rights i.urban##c.year i.party male south white age edulevel income_quartile dem
eststo rights
 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(rights, replace)

logit crime i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo crime

margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(crime, replace)

logit budget i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo budget

margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(budget, replace)

logit agric i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo agric

margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(agric, replace)

logit immig i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo immig

margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(immig, replace)

logit values i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo values

margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(values, replace)

logit fpolicy i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo fpolicy

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(fpolicy, replace)

logit drugs i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo drugs

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(drugs, replace)

logit edu i.urban##c.year i.party male south white age edulevel income_quartile dem 
eststo edu

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(edu, replace)

logit health i.urban##c.year i.party male south white age edulevel income_quartile dem
eststo health
 
margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(health, replace)


esttab budget agric values immig econ tax using fig2models.tex, title("reg") append starlevels(* 0.1 ** 0.05 *** 0.01)

esttab rights crime edu fpolicy health drugs using fig3models.tex, title("reg") append starlevels(* 0.1 ** 0.05 *** 0.01)





****************************************************************************************************
* TABLE C3 and TABLE C4 in the Online Appendix
****************************************************************************************************


* Urban-Rural Gaps across Time --- Interaction with Party
logit rights i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo rights2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gray) lpattern("--")) name(party_rights, replace)

logit values i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo values2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_values, replace)

logit health i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo health2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_health, replace)

logit edu i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo edu2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_edu, replace)

logit drugs i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo drugs2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_drugs, replace)

logit fpolicy i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo fpolicy2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_fpolicy, replace)

logit immig i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo immig2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_immig, replace)

logit agric i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo agric2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_agric, replace)

logit budget i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo budget2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_budget, replace)

logit economy i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo economy2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_economy, replace)

logit tax i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo tax2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_tax, replace)

logit crime i.urban##i.party##c.year male south white age edulevel income_quartile dem 
eststo crime2

*margins, at(year=(1960(5)2020) party=(1 3) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(party_crime, replace)

*TABLE C3
esttab budget2 agric2 values2 immig2 economy2 tax2 using fig4models.tex, title("Models presented in Figure 4") append starlevels(* 0.1 ** 0.05 *** 0.01)

*TABLE C4
esttab rights2 crime2 edu2 fpolicy2 health2 drugs2 using fig5models_new.tex, title("Models presented in Figure 5") append starlevels(* 0.1 ** 0.05 *** 0.01)





****************************************************************************************************
 ** TABLE C5 and TABLE C6 in the online appendix
****************************************************************************************************

logit economy i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo econ

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(econ, replace)

logit tax i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo tax

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(tax, replace)

logit rights i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo rights
 
*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(rights, replace)

logit crime i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo crime

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(crime, replace)

logit budget i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo budget

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(budget, replace)

logit agric i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo agric

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(agric, replace)

logit immig i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo immig

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(immig, replace)

logit values i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo values

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(values, replace)

logit fpolicy i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo fpolicy

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(fpolicy, replace)

logit drugs i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo drugs

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(drugs, replace)

logit edu i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo edu

*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(edu, replace)

logit health i.urban##c.year i.party male south white age edulevel income_quartile dem [pw=pop_amwe]
eststo health
 
*margins, at(year=(1960(5)2020) urban=(0(1)1)) level(95)
*marginsplot, recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs6) lpattern("--")) name(health, replace)



esttab budget agric values immig econ tax using newappend1.tex, title("reg") append starlevels(* 0.1 ** 0.05 *** 0.01)

esttab rights crime edu fpolicy health drugs using newappend2.tex, title("reg") append starlevels(* 0.1 ** 0.05 *** 0.01)








